package j01thread;

class MyThread extends Thread{
    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("hello="+i);
        }
    }
}

public class J1 {
    public static void main(String[] args) {
        MyThread t1 = new MyThread();
        // 不可以这样，
        //t1一旦启动，
        t1.start();
//        System.out.println("main end");
        for (int i = 0; i < 100; i++) {
            System.out.println("main="+i);
        }
    }
}

class J2{
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            @Override
            public void run() {
                System.out.println("t1 start");
            }
        };
        t1.start();
    }
}
